﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Telerik.Web.Mvc.UI;
using Microhard.JHWorkflowTrans;
using Microhard.WebUI.Models;
using Telerik.Web.Mvc;
using Microhard.Core.DBUtility;
using Microhard.Permission.MVCFilter;
using Microhard.Permission.Models;
using Microhard.Permission.Interface;
using Microhard.Core;

namespace Microhard.WarehouseInsp.WebUI.Areas.WarehouseInsp.Controllers
{
    public class JHBaseDataController : Controller
    {
        [MVCFilterAtrForLogon()]
        public virtual ActionResult _ListUser(JHUserModel model, ScopeResult scope)
        {
            var data = JHWorkflowTool.GetUsers(model);
            var userModel = new GridModel()
            {
                Data = data,
                Total = 0
            };
            return new JsonResult
            {
                Data = userModel,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            };
        }

        [MVCFilterAtrForLogon()]
        public virtual ActionResult _ListSysUser(User user, ScopeResult scope)
        {
            IUser iuser = IoC.Resolve<IUser>();
            user.QueryForRealName = true;
            var rtn = iuser.Query(user);
            GridModel data = new GridModel()
            {
                Data = rtn,
            };
            return Json(data, JsonRequestBehavior.AllowGet);
        }

        /// <summary>
        /// 流程发起用户选择
        /// </summary>
        /// <returns></returns>
        [MVCFilterAtrForLogon()]
        public ActionResult SelectUser(AttributeOfWindow aowModel)
        {
            return View(aowModel);
        }

        /// <summary>
        /// PM选择
        /// </summary>
        /// <param name="aowModel"></param>
        /// <returns></returns>
        [MVCFilterAtrForLogon()]
        public ActionResult SelectPM(AttributeOfWindow aowModel)
        {
            return View(aowModel);
        }

        /// <summary>
        /// 选择巡检员
        /// </summary>
        /// <param name="aowModel"></param>
        /// <returns></returns>
        [MVCFilterAtrForLogon()]
        public ActionResult SelectProtal(AttributeOfWindow aowModel)
        {
            return View(aowModel);
        }

        /// <summary>
        /// 选择监管员
        /// </summary>
        /// <param name="aowModel"></param>
        /// <returns></returns>
        [MVCFilterAtrForLogon()]
        public ActionResult SelectSupEmp(AttributeOfWindow aowModel)
        {
            return View(aowModel);
        }

        /// <summary>
        /// 选择业务员
        /// </summary>
        /// <param name="aowModel"></param>
        /// <returns></returns>
        [MVCFilterAtrForLogon()]
        public ActionResult SelectSaler(AttributeOfWindow aowModel)
        {
            return View(aowModel);
        }

    }
}
